'use strict';

const {Service} = require('egg');

class UserService extends Service {
    //查此手机号是否存在
    async selectUser(phone) {
        return await this.app.mysql.query('select * from userlist where phone=?',[phone])
    }
    //注册
    async registry(phone,hmcPwd,role){
        await this.app.mysql.query('insert into userlist (phone,password,role) values (?,?,?)',[phone,hmcPwd,role])
    }
    //登录
    async login(phone,hmcPwd){
        return this.app.mysql.query('select * from userlist where phone=? and password=?',[phone,hmcPwd])
    }
}

module.exports = UserService;
